<html>
<head><meta charset="utf-8"><title>const determinism opts · t-compiler/const-eval · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/index.html">t-compiler/const-eval</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20determinism.20opts.html">const determinism opts</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="213733886"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20determinism%20opts/near/213733886" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20determinism.20opts.html#213733886">(Oct 19 2020 at 00:39)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span> I am curious if you have a reference with specific examples of optimizations that were envisioned that hinge specifically on the runtime determinism of const fn?</p>



<a name="213734006"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20determinism%20opts/near/213734006" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20determinism.20opts.html#213734006">(Oct 19 2020 at 00:42)</a>:</h4>
<p>I have a feeling that I need a better picture of what the goals are in order to work through the problems with floats, since I suspect it's sliiightly more subtle or at least gradated than just "runtime determinism" if having out-of-spec behavior is acceptable on any platform.</p>



<a name="213762020"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20determinism%20opts/near/213762020" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20determinism.20opts.html#213762020">(Oct 19 2020 at 09:40)</a>:</h4>
<p>I wasn't about optimizations but about unsafe code</p>



<a name="213762045"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20determinism%20opts/near/213762045" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20determinism.20opts.html#213762045">(Oct 19 2020 at 09:41)</a>:</h4>
<p>basically, unsafe code might rely on <code>f(x) == f(x)</code> being true, and cause UB otherwise</p>



<a name="213762087"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20determinism%20opts/near/213762087" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20determinism.20opts.html#213762087">(Oct 19 2020 at 09:41)</a>:</h4>
<p>one example (that doesnt demonstrate the need for determinism but demonstrates the need for not having observable side-effects) is <a href="https://en.wikipedia.org/wiki/Memoization">memoization</a></p>



<a name="213762218"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20determinism%20opts/near/213762218" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20determinism.20opts.html#213762218">(Oct 19 2020 at 09:43)</a>:</h4>
<p>it was also discussed that things like <code>DerefMove</code> need to be deterministic, or that having deterministic <code>Deref</code>/<code>DerefMut</code> could allow more code than we can allow currently, but I am fuzzy on the details right now (and short on time so I cannot work them out again, sorry)</p>



<a name="213865110"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/const%20determinism%20opts/near/213865110" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/const.20determinism.20opts.html#213865110">(Oct 20 2020 at 00:53)</a>:</h4>
<p>Ahhhh.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>